package com.kim.logs.enums;

/**
 * @Project: ymdx-security-logs
 * @PackageName: com.ymdx.security.logs.enums
 * @FileName: LogsTypeEnums.java
 * @Description: The LogsTypeEnums is...
 * @Author: kimwu
 * @Time: 2020-11-09 10:41:56
 */
public enum LogsTypeEnums {


    ADD(1, "增"),
    DELETE(2, "删"),
    UPDATE(3, "改"),
    ;

    private final Integer code;

    private final String msg;

    private LogsTypeEnums(final Integer code, final String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static Integer getValue(String msg) {
        LogsTypeEnums[] businessModeEnums = values();
        for (LogsTypeEnums businessModeEnum : businessModeEnums) {
            if (businessModeEnum.msg().equals(msg)) {
                return businessModeEnum.code();
            }
        }
        return null;
    }

    public static String getDesc(Integer value) {
        LogsTypeEnums[] businessModeEnums = values();
        for (LogsTypeEnums businessModeEnum : businessModeEnums) {
            if (businessModeEnum.code().equals(value)) {
                return businessModeEnum.msg();
            }
        }
        return null;
    }

    public Integer code() {
        return this.code;
    }

    public String msg() {
        return this.msg;
    }
}
